package cn.com.ntr.jhclient.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import cn.com.ntr.jhclient.R;
import cn.com.ntr.jhclient.model.FuncModual;

public class CareerInfoAdapter extends EnhancedAdapter<FuncModual> {

	public CareerInfoAdapter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	public void addAll(List<FuncModual> list) {
		this.dataList = list;
		notifyDataSetChanged();
	}

	@Override
	protected void bindView(View paramView, Context paramContext, int position) {
		// TODO Auto-generated method stub
		FuncModual modual = getItem(position);
		ViewHolder holder = (ViewHolder) paramView.getTag();
		holder.btnIcon.setBackgroundResource(modual.getResId());
		holder.textTitle.setText(modual.getTitle());
	}

	@Override
	protected View newView(Context context, int i, ViewGroup viewgroup) {
		// TODO Auto-generated method stub
		View view = LayoutInflater.from(mContext).inflate(
				R.layout.activity_career_list_item, null);
		ViewHolder holder = new ViewHolder();
		holder.btnIcon = (ImageView) view.findViewById(R.id.btn_model_item);
		holder.textTitle = (TextView) view.findViewById(R.id.txt_title);
		view.setTag(holder);
		return view;
	}

	private class ViewHolder {
		ImageView btnIcon;
		TextView textTitle;
	}
}
